package com.sys.object.common.page;

import java.util.List;
import java.util.Map;

/**
 * @author csm
 * @date 2011-09-15
 * @description 分页需要的bean
 * */

public class PageBean {

	private int currentPage=1; // 当前页
	private int perpage; // 每页大小
	private int rowCount; // 总行数
	private int pageCount; // 总页数
	private List<?> list; // 数据
	private String type;// 判断是否带查询条件的标志
	private int startRow;
	private Map map;

	/**
	 * @return the map
	 */
	public Map getMap() {
		return map;
	}

	/**
	 * @param map
	 *            the map to set
	 */
	public void setMap(Map map) {
		this.map = map;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	
	/**
	 * @return the currentPage
	 */
	public int getCurrentPage() {
		if(this.currentPage == 0)
			this.currentPage = 1;
		return currentPage;
	}

	/**
	 * @param currentPage the currentPage to set
	 */
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	/**
	 * @return the perpage
	 */
	public int getPerpage() {
		if(this.perpage<1)
			this.perpage =10;
		return perpage;
	}

	/**
	 * @param perpage the perpage to set
	 */
	public void setPerpage(int perpage) {
		this.perpage = perpage;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public int getPageCount() {
		pageCount = this.rowCount==0?0:(this.rowCount - 1) / this.perpage + 1;
		return pageCount;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	/**
	 * @return the list
	 */
	public List<?> getList() {
		return list;
	}

	/**
	 * @param list the list to set
	 */
	public void setList(List<?> list) {
		this.list = list;
	}

	public int getStartRow() {
		startRow = (this.currentPage - 1) * this.perpage;
		return startRow;
	}

	public void setStartRow(int startRow) {
		this.startRow = startRow;
	}



}
